package com.fanben100.gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder;

/**
 * 关于对话框
 * 
 * @author CYC
 * 
 */
public class CopyrightDialog extends JDialog {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public CopyrightDialog(JFrame frame, boolean modal) {
		super(frame, "关于返本POS", modal);
		this.setPreferredSize(new Dimension(300, 220));
		this.setSize(new Dimension(300, 220));
		this.setLocationRelativeTo(frame);
		try {
			jbInit();
			pack();
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	Icon iconImage = new ImageIcon("image\\CopyrightBackground.gif");// 背景
	Icon icon = new ImageIcon("image\\icons\\CopyrightIcon.png");// 背景图标
	JLabel lblImage = new JLabel();
	JLabel lblImageIcon = new JLabel();
	JLabel lblText1 = new JLabel();
	JLabel lblText2 = new JLabel();
	JLabel lblText3 = new JLabel();
	TitledBorder titledBorder1 = new TitledBorder("");
	JButton btnClose = new JButton();

	private void jbInit() throws Exception {
		// this.setPreferredSize(new Dimension(300, 200));
		this.getContentPane().setLayout(null);
		lblImage.setIcon(iconImage);
		lblImageIcon.setIcon(icon);
		lblImageIcon.setBounds(new Rectangle(16, 15, 50, 45));
		lblText1.setFont(new java.awt.Font("宋体", Font.BOLD, 13));
		lblText1.setForeground(Color.black);
		lblText1.setText("返本100超市收银系统 V 1.0.0");
		lblText1.setBounds(new Rectangle(30, 16, 200, 15));
		lblText2.setForeground(Color.darkGray);
		lblText2.setText("重庆帅拍科技保留所有权利");
		lblText2.setBounds(new Rectangle(60, 43, 170, 15));
		lblText3.setForeground(Color.red);
		lblText3.setBorder(null);
		lblText3.setDebugGraphicsOptions(0);
		lblText3.setHorizontalAlignment(SwingConstants.CENTER);
		lblText3.setHorizontalTextPosition(SwingConstants.CENTER);
		lblText3.setText("Email:520java@gmail.com");
		lblText3.setBounds(new Rectangle(10, 78, 250, 17));
		btnClose.setBounds(new Rectangle(98, 116, 81, 23));
		btnClose.setText("关闭");
		btnClose.addActionListener(new CopyrightDialog_btnClose_actionAdapter(
				this));
		lblImage.setBounds(new Rectangle(0, 0, 300, 220));
		this.getContentPane().add(lblImageIcon);
		this.getContentPane().add(lblText2);
		this.getContentPane().add(lblText1);
		this.getContentPane().add(lblText3);
		this.getContentPane().add(btnClose);
		this.getContentPane().add(lblImage, null);
	}

	public void btnClose_actionPerformed(ActionEvent e) {
		this.dispose();// 关闭窗口
	}
}

class CopyrightDialog_btnClose_actionAdapter implements ActionListener {
	private CopyrightDialog adaptee;

	CopyrightDialog_btnClose_actionAdapter(CopyrightDialog adaptee) {
		this.adaptee = adaptee;
	}

	public void actionPerformed(ActionEvent e) {
		adaptee.btnClose_actionPerformed(e);
	}
}
